<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../style.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../print.css" type="text/css" media="print">
<meta content="AddChild,mx.states.AddChild,position,relativeTo,creationPolicy,target,targetFactory,apply,createInstance,initialize,remove" name="keywords">
<title>mx.states.AddChild</title>
</head>
<body>
<script type="text/javascript" language="javascript" src="../../asdoc.js"></script><script type="text/javascript" language="javascript" src="../../cookies.js"></script><script type="text/javascript" language="javascript">
<!--
				asdocTitle = 'AddChild - Zentrum virtUOS: virtPresenter';
				var baseRef = '../../';
				window.onload = configPage;
			--></script>
<table style="display:none" id="titleTable" cellspacing="0" cellpadding="0" class="titleTable">
<tr>
<td align="left" class="titleTableTitle">virtPresenter AsDoc</td><td align="right" class="titleTableTopNav"><a onclick="loadClassListFrame('../../all-classes.html')" href="../../package-summary.html">All&nbsp;Packages</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../all-classes.html')" href="../../class-summary.html">All&nbsp;Classes</a>&nbsp;|&nbsp;<a onclick="loadClassListFrame('../../index-list.html')" href="../../all-index-A.html">Index</a>&nbsp;|&nbsp;<a href="../../index.html?mx/states/AddChild.html&amp;mx/states/class-list.html" id="framesLink1">Frames</a><a onclick="parent.location=document.location" href="" style="display:none" id="noFramesLink1">No&nbsp;Frames</a></td><td rowspan="3" align="right" class="titleTableLogo"><img alt="Adobe Logo" title="Adobe Logo" class="logoImage" src="../../images/logo.jpg"></td>
</tr>
<tr class="titleTableRow2">
<td align="left" id="subTitle" class="titleTableSubTitle">Class&nbsp;AddChild</td><td align="right" id="subNav" class="titleTableSubNav"><a href="#propertySummary">Properties</a>&nbsp;| <a href="#methodSummary">Methods</a></td>
</tr>
<tr class="titleTableRow3">
<td colspan="2">&nbsp;</td>
</tr>
</table>
<script type="text/javascript" language="javascript">
<!--
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("Class AddChild"); titleBar_setSubNav(false,true,false,false,false,false,true,false,false,false,false,false,false,false);}
--></script>
<div class="MainContent">
<table cellspacing="0" cellpadding="0" class="classHeaderTable">
<tr>
<td class="classHeaderTableLabel">Package</td><td><a onclick="javascript:loadClassListFrame('class-list.html')" href="package-detail.html">mx.states</a></td>
</tr>
<tr>
<td class="classHeaderTableLabel">Class</td><td class="classSignature">public class AddChild</td>
</tr>
<tr>
<td class="classHeaderTableLabel">Implements</td><td><a href="IOverride.html">IOverride</a></td>
</tr>
</table>
<p></p>
  The AddChild class adds a child display object, such as a component, 
  to a container as part of a view state. 
  You use this class in the <code>overrides</code> property of the State class.
  Use the <code>creationPolicy</code> property to specify to create the child 
  at application startup or when you change to a view state. 
  
  <p>The child does not dispatch the <code>creationComplete</code> event until 
  it is added to a container. For example, the following code adds a 
  Button control as part of a view state change:</p>
 
  <pre>
  &lt;mx:AddChild relativeTo="{v1}"&gt;
      &lt;mx:Button id="b0" label="New Button"/&gt;
  &lt;/mx:AddChild&gt; </pre>
   <p>In the previous example, the Button control does not dispatch 
  the <code>creationComplete</code> event until you change state and the 
  Button control is added to a container. 
  If the AddChild class defines both the Button and a container, such as a Canvas container, 
  then the Button control dispatches the creationComplete event when it is created. 
  For example, if the <code>creationPolicy</code> property is set to <code>all</code>, 
  the Button control dispatches the event at application startup. 
  If the <code>creationPolicy</code> property is set to <code>auto</code>,
  the Button control dispatches the event when you change to the view state. </p>
   <p></p>
<a name="mxmlSyntaxSummary"></a><span class="classHeaderTableLabel">MXML Syntax</span><span style="display:none" id="showMxmlLink"><a onclick="toggleMXMLOnly();" href="#mxmlSyntaxSummary"><img class="collapsedImage" alt="collapsed" title="collapsed" src="../../images/collapsed.gif"> Show MXML Syntax</a>
<br>
</span><span id="hideMxmlLink"><a onclick="toggleMXMLOnly();" href="#mxmlSyntaxSummary"><img class="expandedImage" alt="expanded" title="expanded" src="../../images/expanded.gif"> Hide MXML Syntax</a></span>
<div class="mxmlSyntax" id="mxmlSyntax">   <p>The <code>&lt;mx:AddChild&gt;</code> tag
  has the following attributes:</p>
  
  <pre>
  &lt;mx:AddChild
  <b>Properties</b>
  target="null"
  targetFactory="null"
  creationPolicy="auto"
  position="lastChild"
  relativeTo="<i>parent of the State object</i>"
  /&gt;
  </pre>
   </div>
<script type="text/javascript" language="javascript">
<!--
setMXMLOnly();
--></script>
<p>
<span class="classHeaderTableLabel">Default MXML Property</span><code>targetFactory</code>
</p>
<p>
<span class="classHeaderTableLabel">See also</span>
</p>
<div class="seeAlso">
<a href="../states/State.html" target="">mx.states.State</a>
<br>mx.states.RemoveChild<br>
<a href="../states/Transition.html" target="">mx.states.Transition</a>
<br>mx.effects.AddChildAction</div>
<br>
<hr>
</div>
<a name="propertySummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Properties</div>
<table id="summaryTableProperty" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Property</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#creationPolicy">creationPolicy</a> : String<div class="summaryTableDescription">
      The creation policy for this child.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#position">position</a> : String<div class="summaryTableDescription">
      The position of the child in the display list, relative to the
      object specified by the <code>relativeTo</code> property.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#relativeTo">relativeTo</a> : <a href="../core/UIComponent.html">UIComponent</a>
<div class="summaryTableDescription">
      The object relative to which the child is added.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#target">target</a> : DisplayObject<div class="summaryTableDescription">
           The child to be added.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol"><a class="signatureLink" href="#targetFactory">targetFactory</a> : <a href="../core/IDeferredInstance.html">IDeferredInstance</a>
<div class="summaryTableDescription">
          The factory that creates the child.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
</table>
</div>
<a name="methodSummary"></a>
<div class="summarySection">
<div class="summaryTableTitle">Public Methods</div>
<table id="summaryTableMethod" class="summaryTable " cellpadding="3" cellspacing="0">
<tr>
<th>&nbsp;</th><th colspan="2">Method</th><th class="summaryTableOwnerCol">Defined&nbsp;by</th>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#AddChild()">AddChild</a>(relativeTo:<a href="../core/UIComponent.html">UIComponent</a> = null, target:DisplayObject = null, position:String = "lastChild")</div>
<div class="summaryTableDescription">
      Constructor.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#apply()">apply</a>(parent:<a href="../core/UIComponent.html">UIComponent</a>):void</div>
<div class="summaryTableDescription">
      
   Applies the override.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#createInstance()">createInstance</a>():void</div>
<div class="summaryTableDescription">
      Creates the child instance from the factory.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#initialize()">initialize</a>():void</div>
<div class="summaryTableDescription">
      
   Initializes the override.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
<tr class="">
<td class="summaryTablePaddingCol">&nbsp;</td><td class="summaryTableInheritanceCol">&nbsp;</td><td class="summaryTableSignatureCol">
<div class="summarySignature">
<a class="signatureLink" href="#remove()">remove</a>(parent:<a href="../core/UIComponent.html">UIComponent</a>):void</div>
<div class="summaryTableDescription">
      
   Removes the override.</div>
</td><td class="summaryTableOwnerCol">AddChild</td>
</tr>
</table>
</div>
<script type="text/javascript" language="javascript">
<!--
showHideInherited();
--></script>
<div class="MainContent">
<a name="propertyDetail"></a>
<div class="detailSectionHeader">Property detail</div>
<a name="creationPolicy"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">creationPolicy</td><td class="detailHeaderType">property</td>
</tr>
</table>
<div class="detailBody">
<code>creationPolicy:String</code>&nbsp;&nbsp;[read-write]<p>
      The creation policy for this child.
      This property determines when the <code>targetFactory</code> will create 
      the instance of the child.
      Flex uses this properthy only if you specify a <code>targetFactory</code> property.
      The following values are valid:
     
      </p><p></p>
     <table class="innertable">
         <tr><th>Value</th><th>Meaning</th></tr>
         <tr><td><code>auto</code></td><td>(default)Create the instance the 
             first time it is needed.</td></tr>
         <tr><td><code>all</code></td><td>Create the instance when the 
             application started up.</td></tr>
         <tr><td><code>none</code></td><td>Do not automatically create the instance. 
             You must call the <code>createInstance()</code> method to create 
             the instance.</td></tr>
     </table>
           <p>The default value is <code>"auto"</code>.</p>
<span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get creationPolicy():String</code>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set creationPolicy(value:String):void</code>
<br>
</div>
<a name="position"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">position</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var position:String</code><p>
      The position of the child in the display list, relative to the
      object specified by the <code>relativeTo</code> property.
      Valid values are <code>"before"</code>, <code>"after"</code>, 
      <code>"firstChild"</code>, and <code>"lastChild"</code>.
           </p><p>The default value is <code>"lastChild"</code>.</p>
</div>
<a name="relativeTo"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">relativeTo</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public var relativeTo:<a href="../core/UIComponent.html">UIComponent</a></code><p>
      The object relative to which the child is added. This property is used
      in conjunction with the <code>position</code> property. 
      This property is optional; if
      you omit it, Flex uses the immediate parent of the <code>State</code>
      object, that is, the component that has the <code>states</code>
      property, or <code>&lt;mx:states&gt;</code>tag that specifies the State
      object.
     </p></div>
<a name="target"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">target</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>target:DisplayObject</code>&nbsp;&nbsp;[read-write]<p>
           The child to be added.
      If you set this property, the child instance is created at app startup.
      Setting this property is equivalent to setting a <code>targetFactory</code>
      property with a <code>creationPolicy</code> of <code>"all"</code>.
           </p><p>Do not set this property if you set the <code>targetFactory</code>
      property.</p>
     <span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get target():DisplayObject</code>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set target(value:DisplayObject):void</code>
<br>
</div>
<a name="targetFactory"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">targetFactory</td><td class="detailHeaderType">property</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>targetFactory:<a href="../core/IDeferredInstance.html">IDeferredInstance</a></code>&nbsp;&nbsp;[read-write]<p>
          The factory that creates the child. You can specify either of the following items:
      <ul>
          <li>A factory class that implements the IDeferredInstance
              interface and creates the child instance or instances.
          </li>
          <li>A Flex component, (that is, any class that is a subclass
              of the UIComponent class), such as the Button contol.
              If you use a Flex component, the Flex compiler automatically
              wraps the component in a factory class.
          </li>
      </ul>
           </p><p>If you set this property, the child is instantiated at the time
      determined by the <code>creationPolicy</code> property.</p>
      
      <p>Do not set this property if you set the <code>target</code>
      property.
      This propety is the <code>AddChild</code> class default property.
      Setting this property with a <code>creationPolicy</code> of "all"
      is equivalent to setting a <code>target</code> property.</p>
     <span class="label">Implementation</span>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function get targetFactory():<a href="../core/IDeferredInstance.html">IDeferredInstance</a></code>
<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;public function set targetFactory(value:<a href="../core/IDeferredInstance.html">IDeferredInstance</a>):void</code>
<br>
</div>
<a name="constructorDetail"></a>
<div class="detailSectionHeader">Constructor detail</div>
<a name="AddChild()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">AddChild</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">constructor</td>
</tr>
</table>
<div class="detailBody">
<code>public function AddChild(relativeTo:<a href="../core/UIComponent.html">UIComponent</a> = null, target:DisplayObject = null, position:String = "lastChild")</code><p>
      Constructor.
           </p><span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">relativeTo</span>:<a href="../core/UIComponent.html">UIComponent</a></code> (default = <code>null</code>)<code></code> &mdash; The component relative to which child is added.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">target</span>:DisplayObject</code> (default = <code>null</code>)<code></code> &mdash; The child object.
      All Flex components are subclasses of the DisplayObject class.
           </td>
</tr>
<tr>
<td class="paramSpacer">&nbsp;</td>
</tr>
<tr>
<td width="20px"></td><td><code><span class="label">position</span>:String</code> (default = "<code>lastChild</code>")<code></code> &mdash; the location in the display list of the <code>target</code>
      relative to the <code>relativeTo</code> component. Must be one of the following:
      "firstChild", "lastChild", "before" or "after".
     </td>
</tr>
</table>
</div>
<a name="methodDetail"></a>
<div class="detailSectionHeader">Method detail</div>
<a name="apply()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">apply</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td>
</tr>
</table>
<div class="detailBody">
<code>public function apply(parent:<a href="../core/UIComponent.html">UIComponent</a>):void</code><p>
      
   Applies the override. Flex retains the original value, so that it can 
   restore the value later in the <code>remove()</code> method.
     </p><p>This method is called automatically when the state is entered.
   It should not be called directly.</p>
     <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">parent</span>:<a href="../core/UIComponent.html">UIComponent</a></code> &mdash; The parent of the state object containing this override.
   The override should use this as its target if an explicit target was
   not specified.
  </td>
</tr>
</table>
</div>
<a name="createInstance()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">createInstance</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function createInstance():void</code><p>
      Creates the child instance from the factory.
      You must use this method only if you specify a <code>targetFactory</code>
      property and a <code>creationPolicy</code> value of <code>"none"</code>.
      Flex automatically calls this method if the <code>creationPolicy</code>
      property value is <code>"auto"</code> or <code>"all"</code>.
      If you call this method multiple times, the child instance is
      created only on the first call.
     </p></div>
<a name="initialize()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">initialize</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function initialize():void</code><p>
      
   Initializes the override.
   Flex calls this method before the first call to the
   <code>apply()</code> method, so you put one-time initialization
   code for the override in this method.
      </p><p>Flex calls this method automatically when the state is entered.
   It should not be called directly.</p>
    </div>
<a name="remove()"></a>
<table cellspacing="0" cellpadding="0" class="detailHeader">
<tr>
<td class="detailHeaderName">remove</td><td class="detailHeaderParens">()</td><td class="detailHeaderType">method</td><td class="detailHeaderRule">&nbsp;</td>
</tr>
</table>
<div class="detailBody">
<code>public function remove(parent:<a href="../core/UIComponent.html">UIComponent</a>):void</code><p>
      
   Removes the override. The value remembered in the <code>apply()</code>
   method is restored.
     </p><p>This method is called automatically when the state is entered.
   It should not be called directly.</p>
     <span class="label">Parameters</span>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20px"></td><td><code><span class="label">parent</span>:<a href="../core/UIComponent.html">UIComponent</a></code> &mdash; The parent of the state object containing this override.
   The override should use this as its target if an explicit target was
   not specified.
  </td>
</tr>
</table>
</div>
<br>
<br>
<hr>
<br>
<p></p>
<center class="copyright"> 
</center>
</div>
</body>
</html>
<!-- -->
